<div class="modal fade bs-modal-lg" id="modelContent">
	<div class="modal-dialog modal-lg">
        <div class="modal-content"></div>
    </div>
</div> 
<div class="portlet box green">
	<div class="portlet-title">
	    <div class="caption"><i class="fa fa-cog"></i>账房 > 单据管理 > 发货单 </div>
		<div class="tools">
			<a href="javascript:;" class="collapse right" data-original-title="" title=""> </a>
    	</div>
    	<div class="actions">
			<a href="javascript:;" class="btn white btn-sm ajax-search"><i class="fa fa-search"></i> 查询 </a>
			<a href="javascript:;" class="btn white btn-sm search-reset"><i class="fa fa-eraser"></i> 清除 </a>
		</div>
	</div>
	<div class="portlet-body form">
	   	<form action="/sendGoods/list" class="form-horizontal" method="get" id="searchForm">
			<div class="form-body">
				<div class="row">
					<input name="exportState" type="hidden" id="exportState" value="true">
					<input name="pid" type="hidden" id="pid">
					<div class="form-group">
						<div class="col-md-3">
							<label class="col-md-4 control-label">发货单号：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="id" value="$!id">
							</div>
						</div>
						<div class="col-md-3">
							<label class="col-md-4 control-label">收货人：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="revicer" value="$!revicer">
							</div>
						</div>
						<div class="col-md-3">
							<label class="col-md-4 control-label">收货人电话：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="rePhone" value="$!rePhone">
							</div>
						</div>
						<div class="col-md-3">
							<label class="col-md-4 control-label">发货仓库：</label>
							<div class="col-md-6">
						    	<select name="senderCompany" class="form-control">
									<option value=""></option>	
									#foreach($item2 in $wareHouseListAll)
									<option >$item2.corporateName</option>	
									#end								
								</select>
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-md-3">
							<label class="control-label col-md-4">生成时间：</label> 
							<label class="col-md-8">
								<input class="form-control" type="text" name="startTime" id="startTime" value="$!startTime" readonly>
								<i class="fa fa-calendar" style="position: absolute;right: 10px;top: 10px"></i>
							</label>
						</div>
						<div class="col-md-3">
							<label class="control-label col-md-2">至：</label> 
							<label class="col-md-8">
								<input class="form-control" type="text" name="endTime" id="endTime" value="$!endTime" readonly>
								<i class="fa fa-calendar" style="position: absolute;right: 10px;top: 10px"></i>
							</label>
						</div>
						<div class="col-md-3">
							<label class="control-label col-md-4">发货时间： </label> 
							<label class="col-md-8">
								<input class="form-control" type="text" name="createStartTime" id="createStartTime" value="$!createStartTime" readonly>
								<i class="fa fa-calendar" style="position: absolute;right: 10px;top: 10px"></i>
							</label>
						</div>
						<div class="col-md-3">
							<label class="control-label col-md-2">至：</label> 
							<label class="col-md-8">
								<input class="form-control" type="text" name="createEndTime" id="createEndTime" value="$!createEndTime" readonly>
								<i class="fa fa-calendar" style="position: absolute;right: 10px;top: 10px"></i>
							</label>
						</div>
					</div>
	    		</div>
			</div>
		</form>
	</div>
</div>

<div class="portlet box green">
    <div class="portlet-title">
		<div class="caption"><i class="fa fa-cogs"></i>数据列表</div>
		<div class="tools"><a href="javascript:;" class="collapse" data-original-title="" title=""> </a></div>
		<div class="actions">
			 <div class="btn-group " >
				<button type="button" class="btn white btn-sm " data-toggle="dropdown"> 
					<i class="fa fa-cloud-download"></i> 导出
				</button>
				<ul class="dropdown-menu pull-right" role="menu">
					<li>
						<a href="javascript:;" class="export-tab"> <i class="fa fa-cube"></i> 指定商品</a>
					</li>
					<li>
						<a href="javascript:;" class="export-all"> <i class="fa fa-cubes"></i> 全部商品</a>
					</li>
				</ul>
			</div>
		</div>
    </div>
    <div class="portlet-body">
    	<div class="dataTables_wrapper no-footer">
			<div class="table-scrollable">
			    <table class="table table-striped table-bordered table-hover icheck-table">
				  	<thead>
						<tr>
							<th><input type="checkbox" class="icheck group-icheck" /></th>
							<th>发货单号</th>
		   		 			<th>订单号</th>
		   		 			<th>发货金额</th>
		   		 			<th>购买会员</th>
		   		 			<th>收货人</th>
		   		 			<th>收货人电话</th>
		   		 			<th>发货仓库</th>
		   		 			<th>物流公司</th>
		   		 			<th>所属企业</th>
		   		 			<th>生成时间</th>
		   		 			<th>发货时间</th>
							<th class="col-md-2">操作</th>
						</tr>
					</thead>
					<tbody>
					#foreach($item in $pageSendGoods.result)
					#set($order=$orderMap.get($item))
					#set($war = $WarMap.get($item))
		  				<tr>
							<td>
								<input type="checkbox" name="checkboxes" class="icheck " value="$!item.id" />
							</td>
							<td>$!item.id</td>
						    <td>$!item.orderId</td>
						    <td>$!order.productFee</td>
						    <td>$!order.userId</td>
						    <td>$!item.revicer</td>
						    <td>$!item.rePhone</td>
						    <td>$!item.senderCompany</td>
						    <td>$!item.transCompany</td>
						    <td>$!order.company</td>
						    <td>$!item.createTimeString</td>
						    <td>$!item.affirmTimeString</td>
			    			<td>
			    				<a href="#modelContent" class=" btn green btn-outline btn-sm ajax-model-get" data-toggle="modal" thref="/sendGoods/printOrder?id=$!item.id" >打印 </a>
								<a class="btn green btn-outline btn-sm ajaxify" href="/sendGoods/detail?id=$!item.id">
									<i class="fa fa-eye"></i>	详情
								</a>
								#if(!$!item.affirmTime)
							    <a  class="btn green btn-outline btn-sm  ajax-update " t_msg="确认无误？" thref="/sendGoods/affirm?id=$!item.id" t_href="/sendGoods/list" href="javascript:vide(0)">
									发货确认
								</a>
								#end
						    </td>		  			
		  				</tr>
					#end
					</tbody>
				</table>
			</div>
			#set($page=$pageSendGoods)
			#set($pageUrl="/sendGoods/list?&pageNo=")
			#parse("_page.htm")
		</div>
		<div>金额总计:$!Numfee</div>
	</div>
</div>
<script type="text/javascript">

		function getcbvalue(){
			var array = new Array()
			var target= $("input[name='checkboxes']");
			//循环加入数组
			
				$.each(target,function(i,v){
					if(v.checked){
						array.push($(v).val());
					}
				});
		 	return array; 
	  }
  
     /**
      *
      * excel 导出
      */
     $(".export-tab").click(function(){
    	 var pIdArray= getcbvalue();
    	 if(pIdArray.length>0){
    		$("#exportState").val(true);
   		    $("#pid").val(pIdArray);
   		    $("#searchForm").attr("action","/sendGoods/exportExcel");
   		 	$("#searchForm").attr("method","POST");
   			$("#searchForm").submit();
   			$("#searchForm").attr("action","/sendGoods/list");
    	 }else{
    		 toastr.warning("请选择商品");
    	 }
     })
     /*
      *  excel 导出全部
      */
     $(".export-all").click(function(){
    	 	$("#exportState").val(false);
    	 	$("#searchForm").attr("action","/sendGoods/exportExcel");
    	 	$("#searchForm").attr("method","POST");
  			$("#searchForm").submit();
  			$("#searchForm").attr("action","/sendGoods/list");
     })
     
     
     
    $("#createStartTime").datepicker(
        {
            language:  "zh-CN",
            autoclose: true,
            startView: 0,
            format: "yyyy-mm-dd",
            clearBtn:true,
            todayBtn:false
        }).on('changeDate', function(ev){
        if(ev.date){
            $("#createStartTime").datepicker('setStartDate', new Date(ev.date.valueOf()))
        }else{
            $("#createEndTime").datepicker('setStartDate',null);
        }
    });
	$("#createEndTime").datepicker(
        {
            language:  "zh-CN",
            autoclose: true,
            startView: 0,
            format: "yyyy-mm-dd",
            clearBtn:true,
            todayBtn:false
        }).on('changeDate', function(ev){
        if(ev.date){
            $("#createStartTime").datepicker('setStartDate', new Date(ev.date.valueOf()))
        }else{
            $("#createEndTime").datepicker('setStartDate',null);
        }
    });
</script>
<script src="/assets/scripts/views-date.js" type="text/javascript"></script>
<script type="text/javascript" src="/assets/scripts/views-icheck.js"></script>